/*
 * @Description: Pagination 
 * @Author: Jinzhu Liu
 * @Date: 2021-12-16 22:22:40
 * @LastEditor: Jinzhu Liu
 * @LastEditTime: 2021-12-18 22:22:56
 */

import { Model } from "sequelize/dist";

function paginate<T extends Model[]>(
    pageData: T, 
    currentPage: number = 1, 
    total: number = 0,
    limit: number = 10
) {
    return {
        pageData,
        currentPage,
        total,
        totalPages: Math.ceil(total / limit),
        limit
    }
}

export default paginate